#######################################
# Order of the Sacred Magdalene
# Events
#######################################

namespace = ggsm


#######################################
# MAINTENANCE
#######################################

# Synchronize society rank traits and removal of chaste/celibate
long_character_event = {
	id = ggsm.1
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		OR = {
			ggsm_order_member_trigger = yes
			ggsm_has_rank_trait_trigger = yes
		}
	}

	immediate = {
		if = {
			limit = {
				ggsm_order_member_trigger = yes
			}

			ggsm_set_rank_trait_effect = yes

			if = {
				limit = {
					trait = chaste
				}
				remove_trait = chaste
			}

			if = {
				limit = {
					trait = celibate
				}
				remove_trait = celibate
			}
		}

		if = {
			limit = {
				NOT = {
					ggsm_order_member_trigger = yes
				}
			}

			ggsm_remove_rank_traits_effect = yes
		}
	}
}


# AI society joining
long_character_event = {
	id = ggsm.2
	hide_window = yes
	is_triggered_only = yes

	ai = yes
	adult = yes
	only_capable = yes
	prisoner = no

	trigger = {
		has_dlc = "Mystics"
		ai = yes
		controls_religion = no

		can_join_society = ggsm_order_sacred_magdalene

		NOT = {
			higher_tier_than = DUKE
		}

		NOR = {
			mercenary = yes
			holy_order = yes
			trait = cynical
		}

		has_secret_religion_trait_trigger = no

		OR = {
			trait = lustful
			trait = nymphomaniac
			trait = seductress
			trait = cheap_whore
			trait = experienced_whore
			trait = exclusive_whore
			trait = theologian
			trait = erudite
			is_priest = yes
			diplomacy = 14
			learning = 14
		}
	}

	immediate = {
		random = {
			chance = 5

			set_character_flag = society_join_block
			set_character_flag = ggsm_rite_in_progress

			long_character_event = {
				id = ggsm.300
			}
		}
	}
}

#######################################
# JOINING THE ORDER
#######################################

# Player requested admission to the Order.
#
# This event is intended to be fired by:
# on_character_ask_to_join_society
#
# ROOT = applicant
# FROM = society
#
# This follows the same basic architecture used by
# vanilla monastic orders.
	long_character_event = {
    id = ggsm.290
    hide_window = yes
    is_triggered_only = yes

    trigger = {
        FROM = {
            leader = {
                society_member_of = ggsm_order_sacred_magdalene
            }
        }

        ggsm_adult_catholic_woman_trigger = yes

        NOT = {
            society_member_of = ggsm_order_sacred_magdalene
        }
    }

    immediate = {
        set_character_flag = society_join_block
        set_character_flag = ggsm_rite_in_progress

        long_character_event = {
            id = ggsm.300
        }
    }
}


#######################################
# RITE OF OPEN MERCY
#######################################

# Beginning of the initiation
long_character_event = {
	id = ggsm.300
	desc = ggsm.300.desc
	picture = GFX_evt_ggsm_sacred_prostitution
	border = GFX_event_long_frame_religion
	is_triggered_only = yes

	option = {
		name = ggsm.300.a

		long_character_event = {
			id = ggsm.301
		}
	}

	option = {
	name = ggsm.300.b

	trigger = {
		ai = no
	}

	set_character_flag = ggsm_refused_rite

	clr_character_flag = ggsm_rite_in_progress
	clr_character_flag = society_join_block
}
}


# Continuation of initiation
long_character_event = {
	id = ggsm.301
	desc = ggsm.301.desc
	picture = GFX_evt_ggsm_sacred_prostitution
	border = GFX_event_long_frame_religion
	is_triggered_only = yes

	option = {
		name = ggsm.301.a

		long_character_event = {
			id = ggsm.310
		}
	}
}


# Successful completion of initiation
# Rite of Open Mercy - Part II
long_character_event = {
	id = ggsm.310
	desc = ggsm.310.desc
	picture = GFX_evt_ggsm_sacred_prostitution
	border = GFX_event_long_frame_religion
	is_triggered_only = yes

	option = {
		name = ggsm.continue
		long_character_event = { id = ggsm.311 }
	}
}

# Rite of Open Mercy - Completion
long_character_event = {
	id = ggsm.311
	desc = ggsm.311.desc
	picture = GFX_evt_ggsm_sacred_prostitution
	border = GFX_event_long_frame_religion
	is_triggered_only = yes

	option = {
		name = ggsm.310.a

		join_society = ggsm_order_sacred_magdalene

		clr_character_flag = ggsm_rite_in_progress
		clr_character_flag = society_join_block
		clr_character_flag = ggsm_refused_rite

		hidden_tooltip = {
			long_character_event = { id = ggsm.1 }
		}
	}
}


#######################################
# RANK 1
#######################################

# Vow of Sacred Prostitution - Part I
long_character_event = {
	id = ggsm.10
	desc = ggsm.10.desc
	picture = GFX_evt_ggsm_sacred_prostitution
	border = GFX_event_large_frame_religion
	is_triggered_only = yes

	option = {
		name = ggsm.10.a

		long_character_event = {
			id = ggsm.14
		}
	}
}


# Vow of Sacred Prostitution - Piercing
# Uses ggsm.10b.* localization
long_character_event = {
	id = ggsm.14
	desc = ggsm.10b.desc
	picture = GFX_evt_ggsm_sacred_prostitution
	border = GFX_event_large_frame_religion
	is_triggered_only = yes

	option = {
		name = ggsm.10b.a

		long_character_event = {
			id = ggsm.11
		}
	}
}


# Vow of Sacred Prostitution - The Vow
long_character_event = {
	id = ggsm.11
	desc = ggsm.11.desc
	picture = GFX_evt_ggsm_sacred_prostitution
	border = GFX_event_large_frame_religion
	is_triggered_only = yes

	option = {
		name = ggsm.11.a

		long_character_event = {
			id = ggsm.12
		}
	}
}


# Vow of Sacred Prostitution - Completion
long_character_event = {
	id = ggsm.12
	desc = ggsm.12.desc
	picture = GFX_evt_ggsm_sacred_prostitution
	border = GFX_event_large_frame_religion
	is_triggered_only = yes

	option = {
		name = ggsm.12.a

		# Show the principal trait gains on the final Sacred Prostitution button.
		tooltip = {
			add_trait = lustful
			add_trait = cheap_whore
			add_trait = bombshell
		}

		hidden_tooltip = {

			# The vow is incompatible with chastity.
			if = {
				limit = {
					trait = chaste
				}
				remove_trait = chaste
			}

			# The vow is incompatible with celibacy.
			if = {
				limit = {
					trait = celibate
				}
				remove_trait = celibate
			}

			# Every new Penitent becomes Lustful.
			if = {
				limit = {
					NOT = {
						trait = lustful
					}
				}
				add_trait = lustful
			}

			# A woman without an existing prostitution rank
			# enters the profession as a Cheap Whore.
			if = {
				limit = {
					NOR = {
						trait = cheap_whore
						trait = experienced_whore
						trait = exclusive_whore
					}
				}
				add_trait = cheap_whore
			}

			set_character_flag = ggsm_sacred_prostitute
			set_character_flag = ggsm_vow_taken
		}

		add_society_currency_minor_effect = yes

		piety = 25
		prestige = 10

		hidden_tooltip = {
			long_character_event = {
				id = ggsm.1
			}
		}

		long_character_event = {
			id = ggsm.13
		}
	}
}


# Vow of Nymphomania
long_character_event = {
	id = ggsm.13
	desc = ggsm.13.desc
	picture = GFX_evt_ggsm_sacred_prostitution
	border = GFX_event_large_frame_religion
	is_triggered_only = yes

	option = {
		name = ggsm.13.a

		add_trait = nymphomaniac

		hidden_tooltip = {
			character_event = {
				id = christ.15
			}
		}
	}
}

#######################################
# RANK 2
#######################################

# Carnal Confession
#
# The decision selects the Catholic penitent, saves that character as
# event_target:ggsm_carnal_confession_target, and chooses the female
# or male chain before the first visible event opens.


# Female Penitent - Part I
long_character_event = {
	id = ggsm.20
	desc = ggsm.20.desc
	picture = GFX_evt_ggsm_carnal_confession
	border = GFX_event_long_frame_religion
	is_triggered_only = yes

	option = {
		name = ggsm.20.a

		long_character_event = {
			id = ggsm.22
		}
	}
}


# Female Penitent - Completion
long_character_event = {
	id = ggsm.22
	desc = ggsm.22.desc
	picture = GFX_evt_ggsm_carnal_confession
	border = GFX_event_long_frame_religion
	is_triggered_only = yes

	option = {
		name = ggsm.22.a

		event_target:ggsm_carnal_confession_target = {
			opinion = {
				who = ROOT
				modifier = ggsm_carnal_confession_grace
				years = 5
			}

			ggsm_teach_lust_effect = yes
		}

		set_character_flag = ggsm_carnal_confession_cooldown

		hidden_tooltip = {
			long_character_event = {
				id = ggsm.21
				days = 365
			}
		}

		ggsm_progress_sacred_prostitution_effect = yes
		add_society_currency_medium_effect = yes
		piety = 30
	}
}


# Male Penitent - Part I
long_character_event = {
	id = ggsm.23
	desc = ggsm.23.desc
	picture = GFX_evt_ggsm_carnal_confession
	border = GFX_event_long_frame_religion
	is_triggered_only = yes

	option = {
		name = ggsm.23.a

		long_character_event = {
			id = ggsm.24
		}
	}
}


# Male Penitent - Completion
long_character_event = {
	id = ggsm.24
	desc = ggsm.24.desc
	picture = GFX_evt_ggsm_carnal_confession
	border = GFX_event_long_frame_religion
	is_triggered_only = yes

	option = {
		name = ggsm.24.a

		event_target:ggsm_carnal_confession_target = {
			opinion = {
				who = ROOT
				modifier = ggsm_carnal_confession_grace
				years = 5
			}

			ggsm_teach_lust_effect = yes
		}

		set_character_flag = ggsm_carnal_confession_cooldown

		hidden_tooltip = {
			long_character_event = {
				id = ggsm.21
				days = 365
			}
		}

		ggsm_progress_sacred_prostitution_effect = yes
		add_society_currency_medium_effect = yes
		piety = 30
	}
}


# Carnal Confession cooldown reset
long_character_event = {
	id = ggsm.21
	hide_window = yes
	is_triggered_only = yes

	immediate = {
		clr_character_flag = ggsm_carnal_confession_cooldown
		clr_character_flag = ggsm_confession_cooldown
	}
}

# Study Sacred Scripture
long_character_event = {
	id = ggsm.30
	desc = ggsm.30.desc
	picture = GFX_evt_ggsm_scripture_study
	border = GFX_event_long_frame_religion
	is_triggered_only = yes

	option = {
		name = ggsm.30.a

		set_character_flag = ggsm_scripture_study_cooldown

		hidden_tooltip = {
			long_character_event = {
				id = ggsm.31
				days = 1095
			}
		}

		ggsm_teach_lust_effect = yes
		add_society_currency_minor_effect = yes

		piety = 25

		add_character_modifier = {
			name = ggsm_sacred_scripture_studies
			months = 24
		}

	}
}


# Scripture Study cooldown reset
long_character_event = {
	id = ggsm.31
	hide_window = yes
	is_triggered_only = yes

	immediate = {
		clr_character_flag = ggsm_scripture_study_cooldown
	}
}


# Lover's Pox Cleansing - self
long_character_event = {
	id = ggsm.40
	desc = ggsm.40.desc
	picture = GFX_evt_ggsm_lovers_pox_cleansing
	border = GFX_event_long_frame_religion
	is_triggered_only = yes

	option = {
		name = ggsm.40.a

		ggsm_cleanse_lovers_pox_effect = yes
		piety = 25
	}
}


# Self-cleansing cooldown reset
long_character_event = {
	id = ggsm.42
	hide_window = yes
	is_triggered_only = yes

	immediate = {
		clr_character_flag = ggsm_self_cleansing_cooldown
	}
}


# Teach Carnal Charity
long_character_event = {
	id = ggsm.50
	desc = ggsm.50.desc
	picture = GFX_evt_ggsm_carnal_charity
	border = GFX_event_long_frame_religion
	is_triggered_only = yes

	# ROOT = Magdalene sister performing the rite
	# FROM = selected Catholic recipient
	# Save the recipient so localization and later effects have a stable scope.
	immediate = {
		FROM = {
			save_event_target_as = ggsm_carnal_charity_target
		}
	}

	option = {
		name = ggsm.50.a

		trigger = {
			event_target:ggsm_carnal_charity_target = {
				religion = catholic
			}
		}

		event_target:ggsm_carnal_charity_target = {
			add_trait = lustful

			opinion = {
				who = ROOT
				modifier = ggsm_taught_carnal_charity
				years = 10
			}
		}

		add_society_currency_medium_effect = yes
	}

	option = {
		name = ggsm.50.b

		trigger = {
			event_target:ggsm_carnal_charity_target = {
				NOT = {
					religion = catholic
				}
			}
		}

		custom_tooltip = {
			text = ggsm_not_for_dogs_tt
		}
	}
}


# Carnal Charity target response
long_character_event = {
	id = ggsm.51
	desc = ggsm.51.desc
	picture = GFX_evt_ggsm_carnal_charity
	border = GFX_event_long_frame_religion
	is_triggered_only = yes

	option = {
		name = ggsm.51.a

		clr_character_flag = ggsm_teaching_charity
		add_society_currency_minor_effect = yes
	}
}


#######################################
# RANK 3
#######################################

# Minister Lover's Pox Cleansing
long_character_event = {
	id = ggsm.60
	desc = ggsm.60.desc
	picture = GFX_evt_ggsm_lovers_pox_cleansing
	border = GFX_event_long_frame_religion
	is_triggered_only = yes

	# ROOT = Magdalene sister performing the rite
	# FROM = selected Catholic recipient
	# Save the recipient so localization and later effects have a stable scope.
	immediate = {
		FROM = {
			save_event_target_as = ggsm_lovers_pox_target
		}
	}

	option = {
		name = ggsm.60.a

		trigger = {
			event_target:ggsm_lovers_pox_target = {
				religion = catholic
			}
		}

		event_target:ggsm_lovers_pox_target = {
			remove_trait = lovers_pox

			add_character_modifier = {
				name = ggsm_cleansed_by_magdalene
				years = 5
			}
		}

		add_society_currency_medium_effect = yes
	}

	option = {
		name = ggsm.60.b

		trigger = {
			event_target:ggsm_lovers_pox_target = {
				NOT = {
					religion = catholic
				}
			}
		}

		custom_tooltip = {
			text = ggsm_not_for_dogs_tt
		}
	}
}


# Original companion event retained for compatibility
long_character_event = {
	id = ggsm.61
	desc = ggsm.61.desc
	picture = GFX_evt_ggsm_lovers_pox_cleansing
	border = GFX_event_long_frame_religion
	is_triggered_only = yes

	option = {
		name = ggsm.61.a
	}
}


#######################################
# RANK 4
#######################################

# Public Altar
long_character_event = {
	id = ggsm.70
	desc = ggsm.70.desc
	picture = GFX_evt_ggsm_public_altar
	border = GFX_event_long_frame_religion
	is_triggered_only = yes

	option = {
		name = ggsm.70.a

		set_character_flag = ggsm_public_altar_cooldown

		hidden_tooltip = {
			long_character_event = {
				id = ggsm.72
				days = 1825
			}
		}

		ggsm_progress_sacred_prostitution_effect = yes
		add_society_currency_major_effect = yes

		prestige = 50
		piety = 25

		add_character_modifier = {
			name = ggsm_public_altar_grace
			months = 60
		}

	}
}


# Public Altar cooldown reset
long_character_event = {
	id = ggsm.72
	hide_window = yes
	is_triggered_only = yes

	immediate = {
		clr_character_flag = ggsm_public_altar_cooldown
	}
}


#######################################
# SOCIETY MISSIONS
#######################################
#
# Missions are self-contained assignments.
# They never require use of a normal society power.
# The player accepts a real society quest, then
# starts the assignment through a mission-only
# society decision.
#
#######################################

#######################################
# QUEST TOMBOLA
#######################################

long_character_event = {
    id = ggsm.200
    hide_window = yes
    is_triggered_only = yes

    trigger = {
        society_member_of = ggsm_order_sacred_magdalene
        has_any_quest = no
        NOT = { has_character_modifier = quest_cooldown_timer }
        any_realm_province = {
            any_province_holding = {
                OR = {
                        has_building = tb_ggsm_magdalene_house_1
                        has_building = tb_ggsm_magdalene_house_2
                        has_building = tb_ggsm_magdalene_house_3
                        has_building = tb_ggsm_magdalene_house_4
                        has_building = tb_ggsm_magdalene_house_5
                        has_building = ca_ggsm_magdalene_house_1
                        has_building = ca_ggsm_magdalene_house_2
                        has_building = ca_ggsm_magdalene_house_3
                        has_building = ca_ggsm_magdalene_house_4
                        has_building = ca_ggsm_magdalene_house_5
                        has_building = ct_ggsm_magdalene_house_1
                        has_building = ct_ggsm_magdalene_house_2
                        has_building = ct_ggsm_magdalene_house_3
                        has_building = ct_ggsm_magdalene_house_4
                        has_building = ct_ggsm_magdalene_house_5
                    }
            }
        }
    }

    immediate = {
        random_list = {

        20 = {
            modifier = {
                factor = 0
                NOT = { society_rank >= 1 }
            }
            modifier = {
                factor = 0
                NOT = { has_character_flag = ggsm_sacred_prostitute }
            }
            society_quest_event = { id = ggsm.9000 days = 1 }
        }
        15 = {
            modifier = {
                factor = 0
                NOT = { society_rank >= 1 }
            }
            modifier = {
                factor = 0
                NOT = { has_character_flag = ggsm_sacred_prostitute }
            }
            society_quest_event = { id = ggsm.9002 days = 1 }
        }
        20 = {
            modifier = {
                factor = 0
                NOT = { society_rank >= 2 }
            }
            society_quest_event = { id = ggsm.9004 days = 1 }
        }
        20 = {
            modifier = {
                factor = 0
                NOT = { society_rank >= 1 }
            }
            society_quest_event = { id = ggsm.9006 days = 1 }
        }
        18 = {
            modifier = {
                factor = 0
                NOT = { society_rank >= 2 }
            }
            society_quest_event = { id = ggsm.9008 days = 1 }
        }
        18 = {
            modifier = {
                factor = 0
                NOT = { society_rank >= 1 }
            }
            society_quest_event = { id = ggsm.9010 days = 1 }
        }
        18 = {
            modifier = {
                factor = 0
                NOT = { society_rank >= 2 }
            }
            society_quest_event = { id = ggsm.9012 days = 1 }
        }
        18 = {
            modifier = {
                factor = 0
                NOT = { society_rank >= 1 }
            }
            society_quest_event = { id = ggsm.9014 days = 1 }
        }
        18 = {
            modifier = {
                factor = 0
                NOT = { society_rank >= 2 }
            }
            society_quest_event = { id = ggsm.9016 days = 1 }
        }
        10 = {
            modifier = {
                factor = 0
                NOT = { society_rank >= 4 }
            }
            society_quest_event = { id = ggsm.9018 days = 1 }
        }
        }
    }
}


#######################################
# MISSION OFFER: TEMPLE PROSTITUTE
#######################################

society_quest_event = {
    id = ggsm.9000
    desc = ggsm.9000.desc
    border = GFX_event_letter_frame_religion
    is_triggered_only = yes

    trigger = {
        society_member_of = ggsm_order_sacred_magdalene
        society_rank >= 1
        has_any_quest = no
        has_character_flag = ggsm_sacred_prostitute
        any_realm_province = {
            any_province_holding = {
                OR = {
                        has_building = tb_ggsm_magdalene_house_1
                        has_building = tb_ggsm_magdalene_house_2
                        has_building = tb_ggsm_magdalene_house_3
                        has_building = tb_ggsm_magdalene_house_4
                        has_building = tb_ggsm_magdalene_house_5
                        has_building = ca_ggsm_magdalene_house_1
                        has_building = ca_ggsm_magdalene_house_2
                        has_building = ca_ggsm_magdalene_house_3
                        has_building = ca_ggsm_magdalene_house_4
                        has_building = ca_ggsm_magdalene_house_5
                        has_building = ct_ggsm_magdalene_house_1
                        has_building = ct_ggsm_magdalene_house_2
                        has_building = ct_ggsm_magdalene_house_3
                        has_building = ct_ggsm_magdalene_house_4
                        has_building = ct_ggsm_magdalene_house_5
                    }
            }
        }
    }

    option = {
        name = ACCEPT
        set_quest = ggsm_quest_temple_prostitute

        random_realm_province = {
            limit = {
                any_province_holding = {
                    OR = {
                        has_building = tb_ggsm_magdalene_house_1
                        has_building = tb_ggsm_magdalene_house_2
                        has_building = tb_ggsm_magdalene_house_3
                        has_building = tb_ggsm_magdalene_house_4
                        has_building = tb_ggsm_magdalene_house_5
                        has_building = ca_ggsm_magdalene_house_1
                        has_building = ca_ggsm_magdalene_house_2
                        has_building = ca_ggsm_magdalene_house_3
                        has_building = ca_ggsm_magdalene_house_4
                        has_building = ca_ggsm_magdalene_house_5
                        has_building = ct_ggsm_magdalene_house_1
                        has_building = ct_ggsm_magdalene_house_2
                        has_building = ct_ggsm_magdalene_house_3
                        has_building = ct_ggsm_magdalene_house_4
                        has_building = ct_ggsm_magdalene_house_5
                    }
                }
            }
            set_quest_target = {
                id = ggsm_quest_temple_prostitute
                society = ggsm_order_sacred_magdalene
                holder = ROOT
            }
        }
    }

    option = {
        name = DECLINE
        custom_tooltip = { text = decline_quest_tooltip }
        add_character_modifier = {
            name = quest_cooldown_timer
            hidden = yes
            days = 365
        }
        ai_chance = { factor = 0 }
    }
}

#######################################
# MISSION OFFER: TEMPLE GANGBANG
#######################################

society_quest_event = {
    id = ggsm.9002
    desc = ggsm.9002.desc
    border = GFX_event_letter_frame_religion
    is_triggered_only = yes

    trigger = {
        society_member_of = ggsm_order_sacred_magdalene
        society_rank >= 1
        has_any_quest = no
        has_character_flag = ggsm_sacred_prostitute
        any_realm_province = {
            any_province_holding = {
                OR = {
                        has_building = tb_ggsm_magdalene_house_1
                        has_building = tb_ggsm_magdalene_house_2
                        has_building = tb_ggsm_magdalene_house_3
                        has_building = tb_ggsm_magdalene_house_4
                        has_building = tb_ggsm_magdalene_house_5
                        has_building = ca_ggsm_magdalene_house_1
                        has_building = ca_ggsm_magdalene_house_2
                        has_building = ca_ggsm_magdalene_house_3
                        has_building = ca_ggsm_magdalene_house_4
                        has_building = ca_ggsm_magdalene_house_5
                        has_building = ct_ggsm_magdalene_house_1
                        has_building = ct_ggsm_magdalene_house_2
                        has_building = ct_ggsm_magdalene_house_3
                        has_building = ct_ggsm_magdalene_house_4
                        has_building = ct_ggsm_magdalene_house_5
                    }
            }
        }
    }

    option = {
        name = ACCEPT
        set_quest = ggsm_quest_temple_gangbang

        random_realm_province = {
            limit = {
                any_province_holding = {
                    OR = {
                        has_building = tb_ggsm_magdalene_house_1
                        has_building = tb_ggsm_magdalene_house_2
                        has_building = tb_ggsm_magdalene_house_3
                        has_building = tb_ggsm_magdalene_house_4
                        has_building = tb_ggsm_magdalene_house_5
                        has_building = ca_ggsm_magdalene_house_1
                        has_building = ca_ggsm_magdalene_house_2
                        has_building = ca_ggsm_magdalene_house_3
                        has_building = ca_ggsm_magdalene_house_4
                        has_building = ca_ggsm_magdalene_house_5
                        has_building = ct_ggsm_magdalene_house_1
                        has_building = ct_ggsm_magdalene_house_2
                        has_building = ct_ggsm_magdalene_house_3
                        has_building = ct_ggsm_magdalene_house_4
                        has_building = ct_ggsm_magdalene_house_5
                    }
                }
            }
            set_quest_target = {
                id = ggsm_quest_temple_gangbang
                society = ggsm_order_sacred_magdalene
                holder = ROOT
            }
        }
    }

    option = {
        name = DECLINE
        custom_tooltip = { text = decline_quest_tooltip }
        add_character_modifier = {
            name = quest_cooldown_timer
            hidden = yes
            days = 365
        }
        ai_chance = { factor = 0 }
    }
}

#######################################
# MISSION OFFER: TEACH HOUSE
#######################################

society_quest_event = {
    id = ggsm.9004
    desc = ggsm.9004.desc
    border = GFX_event_letter_frame_religion
    is_triggered_only = yes

    trigger = {
        society_member_of = ggsm_order_sacred_magdalene
        society_rank >= 2
        has_any_quest = no
        any_realm_province = {
            any_province_holding = {
                OR = {
                        has_building = tb_ggsm_magdalene_house_1
                        has_building = tb_ggsm_magdalene_house_2
                        has_building = tb_ggsm_magdalene_house_3
                        has_building = tb_ggsm_magdalene_house_4
                        has_building = tb_ggsm_magdalene_house_5
                        has_building = ca_ggsm_magdalene_house_1
                        has_building = ca_ggsm_magdalene_house_2
                        has_building = ca_ggsm_magdalene_house_3
                        has_building = ca_ggsm_magdalene_house_4
                        has_building = ca_ggsm_magdalene_house_5
                        has_building = ct_ggsm_magdalene_house_1
                        has_building = ct_ggsm_magdalene_house_2
                        has_building = ct_ggsm_magdalene_house_3
                        has_building = ct_ggsm_magdalene_house_4
                        has_building = ct_ggsm_magdalene_house_5
                    }
            }
        }
    }

    option = {
        name = ACCEPT
        set_quest = ggsm_quest_teach_house

        random_realm_province = {
            limit = {
                any_province_holding = {
                    OR = {
                        has_building = tb_ggsm_magdalene_house_1
                        has_building = tb_ggsm_magdalene_house_2
                        has_building = tb_ggsm_magdalene_house_3
                        has_building = tb_ggsm_magdalene_house_4
                        has_building = tb_ggsm_magdalene_house_5
                        has_building = ca_ggsm_magdalene_house_1
                        has_building = ca_ggsm_magdalene_house_2
                        has_building = ca_ggsm_magdalene_house_3
                        has_building = ca_ggsm_magdalene_house_4
                        has_building = ca_ggsm_magdalene_house_5
                        has_building = ct_ggsm_magdalene_house_1
                        has_building = ct_ggsm_magdalene_house_2
                        has_building = ct_ggsm_magdalene_house_3
                        has_building = ct_ggsm_magdalene_house_4
                        has_building = ct_ggsm_magdalene_house_5
                    }
                }
            }
            set_quest_target = {
                id = ggsm_quest_teach_house
                society = ggsm_order_sacred_magdalene
                holder = ROOT
            }
        }
    }

    option = {
        name = DECLINE
        custom_tooltip = { text = decline_quest_tooltip }
        add_character_modifier = {
            name = quest_cooldown_timer
            hidden = yes
            days = 365
        }
        ai_chance = { factor = 0 }
    }
}

#######################################
# MISSION OFFER: FEED POOR
#######################################

society_quest_event = {
    id = ggsm.9006
    desc = ggsm.9006.desc
    border = GFX_event_letter_frame_religion
    is_triggered_only = yes

    trigger = {
        society_member_of = ggsm_order_sacred_magdalene
        society_rank >= 1
        has_any_quest = no
        any_realm_province = {
            any_province_holding = {
                OR = {
                        has_building = tb_ggsm_magdalene_house_1
                        has_building = tb_ggsm_magdalene_house_2
                        has_building = tb_ggsm_magdalene_house_3
                        has_building = tb_ggsm_magdalene_house_4
                        has_building = tb_ggsm_magdalene_house_5
                        has_building = ca_ggsm_magdalene_house_1
                        has_building = ca_ggsm_magdalene_house_2
                        has_building = ca_ggsm_magdalene_house_3
                        has_building = ca_ggsm_magdalene_house_4
                        has_building = ca_ggsm_magdalene_house_5
                        has_building = ct_ggsm_magdalene_house_1
                        has_building = ct_ggsm_magdalene_house_2
                        has_building = ct_ggsm_magdalene_house_3
                        has_building = ct_ggsm_magdalene_house_4
                        has_building = ct_ggsm_magdalene_house_5
                    }
            }
        }
    }

    option = {
        name = ACCEPT
        set_quest = ggsm_quest_feed_poor

        random_realm_province = {
            limit = {
                any_province_holding = {
                    OR = {
                        has_building = tb_ggsm_magdalene_house_1
                        has_building = tb_ggsm_magdalene_house_2
                        has_building = tb_ggsm_magdalene_house_3
                        has_building = tb_ggsm_magdalene_house_4
                        has_building = tb_ggsm_magdalene_house_5
                        has_building = ca_ggsm_magdalene_house_1
                        has_building = ca_ggsm_magdalene_house_2
                        has_building = ca_ggsm_magdalene_house_3
                        has_building = ca_ggsm_magdalene_house_4
                        has_building = ca_ggsm_magdalene_house_5
                        has_building = ct_ggsm_magdalene_house_1
                        has_building = ct_ggsm_magdalene_house_2
                        has_building = ct_ggsm_magdalene_house_3
                        has_building = ct_ggsm_magdalene_house_4
                        has_building = ct_ggsm_magdalene_house_5
                    }
                }
            }
            set_quest_target = {
                id = ggsm_quest_feed_poor
                society = ggsm_order_sacred_magdalene
                holder = ROOT
            }
        }
    }

    option = {
        name = DECLINE
        custom_tooltip = { text = decline_quest_tooltip }
        add_character_modifier = {
            name = quest_cooldown_timer
            hidden = yes
            days = 365
        }
        ai_chance = { factor = 0 }
    }
}

#######################################
# MISSION OFFER: MINISTER SICK
#######################################

society_quest_event = {
    id = ggsm.9008
    desc = ggsm.9008.desc
    border = GFX_event_letter_frame_religion
    is_triggered_only = yes

    trigger = {
        society_member_of = ggsm_order_sacred_magdalene
        society_rank >= 2
        has_any_quest = no
        any_realm_province = {
            any_province_holding = {
                OR = {
                        has_building = tb_ggsm_magdalene_house_1
                        has_building = tb_ggsm_magdalene_house_2
                        has_building = tb_ggsm_magdalene_house_3
                        has_building = tb_ggsm_magdalene_house_4
                        has_building = tb_ggsm_magdalene_house_5
                        has_building = ca_ggsm_magdalene_house_1
                        has_building = ca_ggsm_magdalene_house_2
                        has_building = ca_ggsm_magdalene_house_3
                        has_building = ca_ggsm_magdalene_house_4
                        has_building = ca_ggsm_magdalene_house_5
                        has_building = ct_ggsm_magdalene_house_1
                        has_building = ct_ggsm_magdalene_house_2
                        has_building = ct_ggsm_magdalene_house_3
                        has_building = ct_ggsm_magdalene_house_4
                        has_building = ct_ggsm_magdalene_house_5
                    }
            }
        }
    }

    option = {
        name = ACCEPT
        set_quest = ggsm_quest_minister_sick

        random_realm_province = {
            limit = {
                any_province_holding = {
                    OR = {
                        has_building = tb_ggsm_magdalene_house_1
                        has_building = tb_ggsm_magdalene_house_2
                        has_building = tb_ggsm_magdalene_house_3
                        has_building = tb_ggsm_magdalene_house_4
                        has_building = tb_ggsm_magdalene_house_5
                        has_building = ca_ggsm_magdalene_house_1
                        has_building = ca_ggsm_magdalene_house_2
                        has_building = ca_ggsm_magdalene_house_3
                        has_building = ca_ggsm_magdalene_house_4
                        has_building = ca_ggsm_magdalene_house_5
                        has_building = ct_ggsm_magdalene_house_1
                        has_building = ct_ggsm_magdalene_house_2
                        has_building = ct_ggsm_magdalene_house_3
                        has_building = ct_ggsm_magdalene_house_4
                        has_building = ct_ggsm_magdalene_house_5
                    }
                }
            }
            set_quest_target = {
                id = ggsm_quest_minister_sick
                society = ggsm_order_sacred_magdalene
                holder = ROOT
            }
        }
    }

    option = {
        name = DECLINE
        custom_tooltip = { text = decline_quest_tooltip }
        add_character_modifier = {
            name = quest_cooldown_timer
            hidden = yes
            days = 365
        }
        ai_chance = { factor = 0 }
    }
}

#######################################
# MISSION OFFER: RECEIVE PILGRIMS
#######################################

society_quest_event = {
    id = ggsm.9010
    desc = ggsm.9010.desc
    border = GFX_event_letter_frame_religion
    is_triggered_only = yes

    trigger = {
        society_member_of = ggsm_order_sacred_magdalene
        society_rank >= 1
        has_any_quest = no
        any_realm_province = {
            any_province_holding = {
                OR = {
                        has_building = tb_ggsm_magdalene_house_1
                        has_building = tb_ggsm_magdalene_house_2
                        has_building = tb_ggsm_magdalene_house_3
                        has_building = tb_ggsm_magdalene_house_4
                        has_building = tb_ggsm_magdalene_house_5
                        has_building = ca_ggsm_magdalene_house_1
                        has_building = ca_ggsm_magdalene_house_2
                        has_building = ca_ggsm_magdalene_house_3
                        has_building = ca_ggsm_magdalene_house_4
                        has_building = ca_ggsm_magdalene_house_5
                        has_building = ct_ggsm_magdalene_house_1
                        has_building = ct_ggsm_magdalene_house_2
                        has_building = ct_ggsm_magdalene_house_3
                        has_building = ct_ggsm_magdalene_house_4
                        has_building = ct_ggsm_magdalene_house_5
                    }
            }
        }
    }

    option = {
        name = ACCEPT
        set_quest = ggsm_quest_receive_pilgrims

        random_realm_province = {
            limit = {
                any_province_holding = {
                    OR = {
                        has_building = tb_ggsm_magdalene_house_1
                        has_building = tb_ggsm_magdalene_house_2
                        has_building = tb_ggsm_magdalene_house_3
                        has_building = tb_ggsm_magdalene_house_4
                        has_building = tb_ggsm_magdalene_house_5
                        has_building = ca_ggsm_magdalene_house_1
                        has_building = ca_ggsm_magdalene_house_2
                        has_building = ca_ggsm_magdalene_house_3
                        has_building = ca_ggsm_magdalene_house_4
                        has_building = ca_ggsm_magdalene_house_5
                        has_building = ct_ggsm_magdalene_house_1
                        has_building = ct_ggsm_magdalene_house_2
                        has_building = ct_ggsm_magdalene_house_3
                        has_building = ct_ggsm_magdalene_house_4
                        has_building = ct_ggsm_magdalene_house_5
                    }
                }
            }
            set_quest_target = {
                id = ggsm_quest_receive_pilgrims
                society = ggsm_order_sacred_magdalene
                holder = ROOT
            }
        }
    }

    option = {
        name = DECLINE
        custom_tooltip = { text = decline_quest_tooltip }
        add_character_modifier = {
            name = quest_cooldown_timer
            hidden = yes
            days = 365
        }
        ai_chance = { factor = 0 }
    }
}

#######################################
# MISSION OFFER: COPY SCRIPTURE
#######################################

society_quest_event = {
    id = ggsm.9012
    desc = ggsm.9012.desc
    border = GFX_event_letter_frame_religion
    is_triggered_only = yes

    trigger = {
        society_member_of = ggsm_order_sacred_magdalene
        society_rank >= 2
        has_any_quest = no
        any_realm_province = {
            any_province_holding = {
                OR = {
                        has_building = tb_ggsm_magdalene_house_1
                        has_building = tb_ggsm_magdalene_house_2
                        has_building = tb_ggsm_magdalene_house_3
                        has_building = tb_ggsm_magdalene_house_4
                        has_building = tb_ggsm_magdalene_house_5
                        has_building = ca_ggsm_magdalene_house_1
                        has_building = ca_ggsm_magdalene_house_2
                        has_building = ca_ggsm_magdalene_house_3
                        has_building = ca_ggsm_magdalene_house_4
                        has_building = ca_ggsm_magdalene_house_5
                        has_building = ct_ggsm_magdalene_house_1
                        has_building = ct_ggsm_magdalene_house_2
                        has_building = ct_ggsm_magdalene_house_3
                        has_building = ct_ggsm_magdalene_house_4
                        has_building = ct_ggsm_magdalene_house_5
                    }
            }
        }
    }

    option = {
        name = ACCEPT
        set_quest = ggsm_quest_copy_scripture

        random_realm_province = {
            limit = {
                any_province_holding = {
                    OR = {
                        has_building = tb_ggsm_magdalene_house_1
                        has_building = tb_ggsm_magdalene_house_2
                        has_building = tb_ggsm_magdalene_house_3
                        has_building = tb_ggsm_magdalene_house_4
                        has_building = tb_ggsm_magdalene_house_5
                        has_building = ca_ggsm_magdalene_house_1
                        has_building = ca_ggsm_magdalene_house_2
                        has_building = ca_ggsm_magdalene_house_3
                        has_building = ca_ggsm_magdalene_house_4
                        has_building = ca_ggsm_magdalene_house_5
                        has_building = ct_ggsm_magdalene_house_1
                        has_building = ct_ggsm_magdalene_house_2
                        has_building = ct_ggsm_magdalene_house_3
                        has_building = ct_ggsm_magdalene_house_4
                        has_building = ct_ggsm_magdalene_house_5
                    }
                }
            }
            set_quest_target = {
                id = ggsm_quest_copy_scripture
                society = ggsm_order_sacred_magdalene
                holder = ROOT
            }
        }
    }

    option = {
        name = DECLINE
        custom_tooltip = { text = decline_quest_tooltip }
        add_character_modifier = {
            name = quest_cooldown_timer
            hidden = yes
            days = 365
        }
        ai_chance = { factor = 0 }
    }
}

#######################################
# MISSION OFFER: WIDOWS ORPHANS
#######################################

society_quest_event = {
    id = ggsm.9014
    desc = ggsm.9014.desc
    border = GFX_event_letter_frame_religion
    is_triggered_only = yes

    trigger = {
        society_member_of = ggsm_order_sacred_magdalene
        society_rank >= 1
        has_any_quest = no
        any_realm_province = {
            any_province_holding = {
                OR = {
                        has_building = tb_ggsm_magdalene_house_1
                        has_building = tb_ggsm_magdalene_house_2
                        has_building = tb_ggsm_magdalene_house_3
                        has_building = tb_ggsm_magdalene_house_4
                        has_building = tb_ggsm_magdalene_house_5
                        has_building = ca_ggsm_magdalene_house_1
                        has_building = ca_ggsm_magdalene_house_2
                        has_building = ca_ggsm_magdalene_house_3
                        has_building = ca_ggsm_magdalene_house_4
                        has_building = ca_ggsm_magdalene_house_5
                        has_building = ct_ggsm_magdalene_house_1
                        has_building = ct_ggsm_magdalene_house_2
                        has_building = ct_ggsm_magdalene_house_3
                        has_building = ct_ggsm_magdalene_house_4
                        has_building = ct_ggsm_magdalene_house_5
                    }
            }
        }
    }

    option = {
        name = ACCEPT
        set_quest = ggsm_quest_widows_orphans

        random_realm_province = {
            limit = {
                any_province_holding = {
                    OR = {
                        has_building = tb_ggsm_magdalene_house_1
                        has_building = tb_ggsm_magdalene_house_2
                        has_building = tb_ggsm_magdalene_house_3
                        has_building = tb_ggsm_magdalene_house_4
                        has_building = tb_ggsm_magdalene_house_5
                        has_building = ca_ggsm_magdalene_house_1
                        has_building = ca_ggsm_magdalene_house_2
                        has_building = ca_ggsm_magdalene_house_3
                        has_building = ca_ggsm_magdalene_house_4
                        has_building = ca_ggsm_magdalene_house_5
                        has_building = ct_ggsm_magdalene_house_1
                        has_building = ct_ggsm_magdalene_house_2
                        has_building = ct_ggsm_magdalene_house_3
                        has_building = ct_ggsm_magdalene_house_4
                        has_building = ct_ggsm_magdalene_house_5
                    }
                }
            }
            set_quest_target = {
                id = ggsm_quest_widows_orphans
                society = ggsm_order_sacred_magdalene
                holder = ROOT
            }
        }
    }

    option = {
        name = DECLINE
        custom_tooltip = { text = decline_quest_tooltip }
        add_character_modifier = {
            name = quest_cooldown_timer
            hidden = yes
            days = 365
        }
        ai_chance = { factor = 0 }
    }
}

#######################################
# MISSION OFFER: STEWARD HOUSE
#######################################

society_quest_event = {
    id = ggsm.9016
    desc = ggsm.9016.desc
    border = GFX_event_letter_frame_religion
    is_triggered_only = yes

    trigger = {
        society_member_of = ggsm_order_sacred_magdalene
        society_rank >= 2
        has_any_quest = no
        any_realm_province = {
            any_province_holding = {
                OR = {
                        has_building = tb_ggsm_magdalene_house_1
                        has_building = tb_ggsm_magdalene_house_2
                        has_building = tb_ggsm_magdalene_house_3
                        has_building = tb_ggsm_magdalene_house_4
                        has_building = tb_ggsm_magdalene_house_5
                        has_building = ca_ggsm_magdalene_house_1
                        has_building = ca_ggsm_magdalene_house_2
                        has_building = ca_ggsm_magdalene_house_3
                        has_building = ca_ggsm_magdalene_house_4
                        has_building = ca_ggsm_magdalene_house_5
                        has_building = ct_ggsm_magdalene_house_1
                        has_building = ct_ggsm_magdalene_house_2
                        has_building = ct_ggsm_magdalene_house_3
                        has_building = ct_ggsm_magdalene_house_4
                        has_building = ct_ggsm_magdalene_house_5
                    }
            }
        }
    }

    option = {
        name = ACCEPT
        set_quest = ggsm_quest_steward_house

        random_realm_province = {
            limit = {
                any_province_holding = {
                    OR = {
                        has_building = tb_ggsm_magdalene_house_1
                        has_building = tb_ggsm_magdalene_house_2
                        has_building = tb_ggsm_magdalene_house_3
                        has_building = tb_ggsm_magdalene_house_4
                        has_building = tb_ggsm_magdalene_house_5
                        has_building = ca_ggsm_magdalene_house_1
                        has_building = ca_ggsm_magdalene_house_2
                        has_building = ca_ggsm_magdalene_house_3
                        has_building = ca_ggsm_magdalene_house_4
                        has_building = ca_ggsm_magdalene_house_5
                        has_building = ct_ggsm_magdalene_house_1
                        has_building = ct_ggsm_magdalene_house_2
                        has_building = ct_ggsm_magdalene_house_3
                        has_building = ct_ggsm_magdalene_house_4
                        has_building = ct_ggsm_magdalene_house_5
                    }
                }
            }
            set_quest_target = {
                id = ggsm_quest_steward_house
                society = ggsm_order_sacred_magdalene
                holder = ROOT
            }
        }
    }

    option = {
        name = DECLINE
        custom_tooltip = { text = decline_quest_tooltip }
        add_character_modifier = {
            name = quest_cooldown_timer
            hidden = yes
            days = 365
        }
        ai_chance = { factor = 0 }
    }
}

#######################################
# MISSION OFFER: FEAST MAGDALENE
#######################################

society_quest_event = {
    id = ggsm.9018
    desc = ggsm.9018.desc
    border = GFX_event_letter_frame_religion
    is_triggered_only = yes

    trigger = {
        society_member_of = ggsm_order_sacred_magdalene
        society_rank >= 4
        has_any_quest = no
        any_realm_province = {
            any_province_holding = {
                OR = {
                        has_building = tb_ggsm_magdalene_house_1
                        has_building = tb_ggsm_magdalene_house_2
                        has_building = tb_ggsm_magdalene_house_3
                        has_building = tb_ggsm_magdalene_house_4
                        has_building = tb_ggsm_magdalene_house_5
                        has_building = ca_ggsm_magdalene_house_1
                        has_building = ca_ggsm_magdalene_house_2
                        has_building = ca_ggsm_magdalene_house_3
                        has_building = ca_ggsm_magdalene_house_4
                        has_building = ca_ggsm_magdalene_house_5
                        has_building = ct_ggsm_magdalene_house_1
                        has_building = ct_ggsm_magdalene_house_2
                        has_building = ct_ggsm_magdalene_house_3
                        has_building = ct_ggsm_magdalene_house_4
                        has_building = ct_ggsm_magdalene_house_5
                    }
            }
        }
    }

    option = {
        name = ACCEPT
        set_quest = ggsm_quest_feast_magdalene

        random_realm_province = {
            limit = {
                any_province_holding = {
                    OR = {
                        has_building = tb_ggsm_magdalene_house_1
                        has_building = tb_ggsm_magdalene_house_2
                        has_building = tb_ggsm_magdalene_house_3
                        has_building = tb_ggsm_magdalene_house_4
                        has_building = tb_ggsm_magdalene_house_5
                        has_building = ca_ggsm_magdalene_house_1
                        has_building = ca_ggsm_magdalene_house_2
                        has_building = ca_ggsm_magdalene_house_3
                        has_building = ca_ggsm_magdalene_house_4
                        has_building = ca_ggsm_magdalene_house_5
                        has_building = ct_ggsm_magdalene_house_1
                        has_building = ct_ggsm_magdalene_house_2
                        has_building = ct_ggsm_magdalene_house_3
                        has_building = ct_ggsm_magdalene_house_4
                        has_building = ct_ggsm_magdalene_house_5
                    }
                }
            }
            set_quest_target = {
                id = ggsm_quest_feast_magdalene
                society = ggsm_order_sacred_magdalene
                holder = ROOT
            }
        }
    }

    option = {
        name = DECLINE
        custom_tooltip = { text = decline_quest_tooltip }
        add_character_modifier = {
            name = quest_cooldown_timer
            hidden = yes
            days = 365
        }
        ai_chance = { factor = 0 }
    }
}



#######################################
# MISSION CHAIN: TEMPLE PROSTITUTE
#######################################

long_character_event = {
    id = ggsm.9100
    desc = ggsm.9100.desc
    picture = GFX_evt_ggsm_sacred_prostitution
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_temple_prostitute
    }

    option = {
        name = ggsm.mission.begin
        hidden_tooltip = {
            long_character_event = { id = ggsm.9101 days = 30 }
        }
    }
}

long_character_event = {
    id = ggsm.9101
    hide_window = yes
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_temple_prostitute
    }

    immediate = {
        random_list = {
            34 = { long_character_event = { id = ggsm.9102 } }
            33 = { long_character_event = { id = ggsm.9103 } }
            33 = { long_character_event = { id = ggsm.9104 } }
        }
    }
}

long_character_event = {
    id = ggsm.9102
    desc = ggsm.9102.desc
    picture = GFX_evt_ggsm_sacred_prostitution
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_temple_prostitute
    }

    option = {
        name = ggsm.mission.continue
        change_variable = { which = ggsm_temple_prostitute_months value = 1 }

        if = {
            limit = { check_variable = { which = ggsm_temple_prostitute_months value = 12 } }
            add_society_currency_medium_effect = yes
            piety = 40
            clr_quest = ggsm_quest_temple_prostitute
            clr_character_flag = ggsm_temple_prostitute_mission_started
            set_variable = { which = ggsm_temple_prostitute_months value = 0 }
        }
        else = {
            hidden_tooltip = {
                long_character_event = { id = ggsm.9101 days = 30 }
            }
        }
    }
}

long_character_event = {
    id = ggsm.9103
    desc = ggsm.9103.desc
    picture = GFX_evt_ggsm_sacred_prostitution
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_temple_prostitute
    }

    option = {
        name = ggsm.mission.continue
        change_variable = { which = ggsm_temple_prostitute_months value = 1 }

        if = {
            limit = { check_variable = { which = ggsm_temple_prostitute_months value = 12 } }
            add_society_currency_medium_effect = yes
            piety = 40
            clr_quest = ggsm_quest_temple_prostitute
            clr_character_flag = ggsm_temple_prostitute_mission_started
            set_variable = { which = ggsm_temple_prostitute_months value = 0 }
        }
        else = {
            hidden_tooltip = {
                long_character_event = { id = ggsm.9101 days = 30 }
            }
        }
    }
}

long_character_event = {
    id = ggsm.9104
    desc = ggsm.9104.desc
    picture = GFX_evt_ggsm_sacred_prostitution
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_temple_prostitute
    }

    option = {
        name = ggsm.mission.continue
        change_variable = { which = ggsm_temple_prostitute_months value = 1 }

        if = {
            limit = { check_variable = { which = ggsm_temple_prostitute_months value = 12 } }
            add_society_currency_medium_effect = yes
            piety = 40
            clr_quest = ggsm_quest_temple_prostitute
            clr_character_flag = ggsm_temple_prostitute_mission_started
            set_variable = { which = ggsm_temple_prostitute_months value = 0 }
        }
        else = {
            hidden_tooltip = {
                long_character_event = { id = ggsm.9101 days = 30 }
            }
        }
    }
}


#######################################
# MISSION CHAIN: TEMPLE GANGBANG
#######################################

long_character_event = {
    id = ggsm.9140
    desc = ggsm.9140.desc
    picture = GFX_evt_ggsm_public_altar
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = { has_quest = ggsm_quest_temple_gangbang }

    option = {
        name = ggsm.mission.continue
        long_character_event = { id = ggsm.9141 }
    }
}

long_character_event = {
    id = ggsm.9141
    desc = ggsm.9141.desc
    picture = GFX_evt_ggsm_public_altar
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = { has_quest = ggsm_quest_temple_gangbang }

    option = {
        name = ggsm.mission.continue
        long_character_event = { id = ggsm.9142 }
    }
}

long_character_event = {
    id = ggsm.9142
    desc = ggsm.9142.desc
    picture = GFX_evt_ggsm_public_altar
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = { has_quest = ggsm_quest_temple_gangbang }

    option = {
        name = ggsm.mission.complete
        add_society_currency_medium_effect = yes
            piety = 25
            prestige = 15
        clr_quest = ggsm_quest_temple_gangbang
        clr_character_flag = ggsm_temple_gangbang_mission_started
    }
}

#######################################
# MISSION CHAIN: TEACH HOUSE
#######################################

long_character_event = {
    id = ggsm.9180
    desc = ggsm.9180.desc
    picture = GFX_evt_ggsm_scripture_study
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_teach_house
    }

    option = {
        name = ggsm.mission.begin
        hidden_tooltip = {
            long_character_event = { id = ggsm.9181 days = 30 }
        }
    }
}

long_character_event = {
    id = ggsm.9181
    hide_window = yes
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_teach_house
    }

    immediate = {
        random_list = {
            34 = { long_character_event = { id = ggsm.9182 } }
            33 = { long_character_event = { id = ggsm.9183 } }
            33 = { long_character_event = { id = ggsm.9184 } }
        }
    }
}

long_character_event = {
    id = ggsm.9182
    desc = ggsm.9182.desc
    picture = GFX_evt_ggsm_scripture_study
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_teach_house
    }

    option = {
        name = ggsm.mission.continue
        change_variable = { which = ggsm_teach_house_months value = 1 }

        if = {
            limit = { check_variable = { which = ggsm_teach_house_months value = 12 } }
            add_society_currency_medium_effect = yes
            piety = 45
            clr_quest = ggsm_quest_teach_house
            clr_character_flag = ggsm_teach_house_mission_started
            set_variable = { which = ggsm_teach_house_months value = 0 }
        }
        else = {
            hidden_tooltip = {
                long_character_event = { id = ggsm.9181 days = 30 }
            }
        }
    }
}

long_character_event = {
    id = ggsm.9183
    desc = ggsm.9183.desc
    picture = GFX_evt_ggsm_scripture_study
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_teach_house
    }

    option = {
        name = ggsm.mission.continue
        change_variable = { which = ggsm_teach_house_months value = 1 }

        if = {
            limit = { check_variable = { which = ggsm_teach_house_months value = 12 } }
            add_society_currency_medium_effect = yes
            piety = 45
            clr_quest = ggsm_quest_teach_house
            clr_character_flag = ggsm_teach_house_mission_started
            set_variable = { which = ggsm_teach_house_months value = 0 }
        }
        else = {
            hidden_tooltip = {
                long_character_event = { id = ggsm.9181 days = 30 }
            }
        }
    }
}

long_character_event = {
    id = ggsm.9184
    desc = ggsm.9184.desc
    picture = GFX_evt_ggsm_scripture_study
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_teach_house
    }

    option = {
        name = ggsm.mission.continue
        change_variable = { which = ggsm_teach_house_months value = 1 }

        if = {
            limit = { check_variable = { which = ggsm_teach_house_months value = 12 } }
            add_society_currency_medium_effect = yes
            piety = 45
            clr_quest = ggsm_quest_teach_house
            clr_character_flag = ggsm_teach_house_mission_started
            set_variable = { which = ggsm_teach_house_months value = 0 }
        }
        else = {
            hidden_tooltip = {
                long_character_event = { id = ggsm.9181 days = 30 }
            }
        }
    }
}


#######################################
# MISSION CHAIN: FEED POOR
#######################################

long_character_event = {
    id = ggsm.9220
    desc = ggsm.9220.desc
    picture = GFX_evt_ggsm_houses_mercy
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_feed_poor
    }

    option = {
        name = ggsm.mission.begin
        hidden_tooltip = {
            long_character_event = { id = ggsm.9221 days = 30 }
        }
    }
}

long_character_event = {
    id = ggsm.9221
    hide_window = yes
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_feed_poor
    }

    immediate = {
        random_list = {
            34 = { long_character_event = { id = ggsm.9222 } }
            33 = { long_character_event = { id = ggsm.9223 } }
            33 = { long_character_event = { id = ggsm.9224 } }
        }
    }
}

long_character_event = {
    id = ggsm.9222
    desc = ggsm.9222.desc
    picture = GFX_evt_ggsm_houses_mercy
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_feed_poor
    }

    option = {
        name = ggsm.mission.continue
        scaled_wealth = -0.01
        change_variable = { which = ggsm_feed_poor_months value = 1 }

        if = {
            limit = { check_variable = { which = ggsm_feed_poor_months value = 12 } }
            add_society_currency_medium_effect = yes
            piety = 60
            clr_quest = ggsm_quest_feed_poor
            clr_character_flag = ggsm_feed_poor_mission_started
            set_variable = { which = ggsm_feed_poor_months value = 0 }
        }
        else = {
            hidden_tooltip = {
                long_character_event = { id = ggsm.9221 days = 30 }
            }
        }
    }
}

long_character_event = {
    id = ggsm.9223
    desc = ggsm.9223.desc
    picture = GFX_evt_ggsm_houses_mercy
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_feed_poor
    }

    option = {
        name = ggsm.mission.continue
        scaled_wealth = -0.01
        change_variable = { which = ggsm_feed_poor_months value = 1 }

        if = {
            limit = { check_variable = { which = ggsm_feed_poor_months value = 12 } }
            add_society_currency_medium_effect = yes
            piety = 60
            clr_quest = ggsm_quest_feed_poor
            clr_character_flag = ggsm_feed_poor_mission_started
            set_variable = { which = ggsm_feed_poor_months value = 0 }
        }
        else = {
            hidden_tooltip = {
                long_character_event = { id = ggsm.9221 days = 30 }
            }
        }
    }
}

long_character_event = {
    id = ggsm.9224
    desc = ggsm.9224.desc
    picture = GFX_evt_ggsm_houses_mercy
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_feed_poor
    }

    option = {
        name = ggsm.mission.continue
        scaled_wealth = -0.01
        change_variable = { which = ggsm_feed_poor_months value = 1 }

        if = {
            limit = { check_variable = { which = ggsm_feed_poor_months value = 12 } }
            add_society_currency_medium_effect = yes
            piety = 60
            clr_quest = ggsm_quest_feed_poor
            clr_character_flag = ggsm_feed_poor_mission_started
            set_variable = { which = ggsm_feed_poor_months value = 0 }
        }
        else = {
            hidden_tooltip = {
                long_character_event = { id = ggsm.9221 days = 30 }
            }
        }
    }
}


#######################################
# MISSION CHAIN: MINISTER SICK
#######################################

long_character_event = {
    id = ggsm.9260
    desc = ggsm.9260.desc
    picture = GFX_evt_ggsm_lovers_pox_cleansing
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_minister_sick
    }

    option = {
        name = ggsm.mission.begin
        hidden_tooltip = {
            long_character_event = { id = ggsm.9261 days = 30 }
        }
    }
}

long_character_event = {
    id = ggsm.9261
    hide_window = yes
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_minister_sick
    }

    immediate = {
        random_list = {
            34 = { long_character_event = { id = ggsm.9262 } }
            33 = { long_character_event = { id = ggsm.9263 } }
            33 = { long_character_event = { id = ggsm.9264 } }
        }
    }
}

long_character_event = {
    id = ggsm.9262
    desc = ggsm.9262.desc
    picture = GFX_evt_ggsm_lovers_pox_cleansing
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_minister_sick
    }

    option = {
        name = ggsm.mission.continue
        change_variable = { which = ggsm_minister_sick_months value = 1 }

        if = {
            limit = { check_variable = { which = ggsm_minister_sick_months value = 6 } }
            add_society_currency_minor_effect = yes
            piety = 35
            clr_quest = ggsm_quest_minister_sick
            clr_character_flag = ggsm_minister_sick_mission_started
            set_variable = { which = ggsm_minister_sick_months value = 0 }
        }
        else = {
            hidden_tooltip = {
                long_character_event = { id = ggsm.9261 days = 30 }
            }
        }
    }
}

long_character_event = {
    id = ggsm.9263
    desc = ggsm.9263.desc
    picture = GFX_evt_ggsm_lovers_pox_cleansing
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_minister_sick
    }

    option = {
        name = ggsm.mission.continue
        change_variable = { which = ggsm_minister_sick_months value = 1 }

        if = {
            limit = { check_variable = { which = ggsm_minister_sick_months value = 6 } }
            add_society_currency_minor_effect = yes
            piety = 35
            clr_quest = ggsm_quest_minister_sick
            clr_character_flag = ggsm_minister_sick_mission_started
            set_variable = { which = ggsm_minister_sick_months value = 0 }
        }
        else = {
            hidden_tooltip = {
                long_character_event = { id = ggsm.9261 days = 30 }
            }
        }
    }
}

long_character_event = {
    id = ggsm.9264
    desc = ggsm.9264.desc
    picture = GFX_evt_ggsm_lovers_pox_cleansing
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_minister_sick
    }

    option = {
        name = ggsm.mission.continue
        change_variable = { which = ggsm_minister_sick_months value = 1 }

        if = {
            limit = { check_variable = { which = ggsm_minister_sick_months value = 6 } }
            add_society_currency_minor_effect = yes
            piety = 35
            clr_quest = ggsm_quest_minister_sick
            clr_character_flag = ggsm_minister_sick_mission_started
            set_variable = { which = ggsm_minister_sick_months value = 0 }
        }
        else = {
            hidden_tooltip = {
                long_character_event = { id = ggsm.9261 days = 30 }
            }
        }
    }
}


#######################################
# MISSION CHAIN: RECEIVE PILGRIMS
#######################################

long_character_event = {
    id = ggsm.9300
    desc = ggsm.9300.desc
    picture = GFX_evt_ggsm_houses_mercy
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_receive_pilgrims
    }

    option = {
        name = ggsm.mission.begin
        hidden_tooltip = {
            long_character_event = { id = ggsm.9301 days = 30 }
        }
    }
}

long_character_event = {
    id = ggsm.9301
    hide_window = yes
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_receive_pilgrims
    }

    immediate = {
        random_list = {
            34 = { long_character_event = { id = ggsm.9302 } }
            33 = { long_character_event = { id = ggsm.9303 } }
            33 = { long_character_event = { id = ggsm.9304 } }
        }
    }
}

long_character_event = {
    id = ggsm.9302
    desc = ggsm.9302.desc
    picture = GFX_evt_ggsm_houses_mercy
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_receive_pilgrims
    }

    option = {
        name = ggsm.mission.continue
        change_variable = { which = ggsm_receive_pilgrims_months value = 1 }

        if = {
            limit = { check_variable = { which = ggsm_receive_pilgrims_months value = 6 } }
            add_society_currency_minor_effect = yes
            piety = 30
            clr_quest = ggsm_quest_receive_pilgrims
            clr_character_flag = ggsm_receive_pilgrims_mission_started
            set_variable = { which = ggsm_receive_pilgrims_months value = 0 }
        }
        else = {
            hidden_tooltip = {
                long_character_event = { id = ggsm.9301 days = 30 }
            }
        }
    }
}

long_character_event = {
    id = ggsm.9303
    desc = ggsm.9303.desc
    picture = GFX_evt_ggsm_houses_mercy
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_receive_pilgrims
    }

    option = {
        name = ggsm.mission.continue
        change_variable = { which = ggsm_receive_pilgrims_months value = 1 }

        if = {
            limit = { check_variable = { which = ggsm_receive_pilgrims_months value = 6 } }
            add_society_currency_minor_effect = yes
            piety = 30
            clr_quest = ggsm_quest_receive_pilgrims
            clr_character_flag = ggsm_receive_pilgrims_mission_started
            set_variable = { which = ggsm_receive_pilgrims_months value = 0 }
        }
        else = {
            hidden_tooltip = {
                long_character_event = { id = ggsm.9301 days = 30 }
            }
        }
    }
}

long_character_event = {
    id = ggsm.9304
    desc = ggsm.9304.desc
    picture = GFX_evt_ggsm_houses_mercy
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_receive_pilgrims
    }

    option = {
        name = ggsm.mission.continue
        change_variable = { which = ggsm_receive_pilgrims_months value = 1 }

        if = {
            limit = { check_variable = { which = ggsm_receive_pilgrims_months value = 6 } }
            add_society_currency_minor_effect = yes
            piety = 30
            clr_quest = ggsm_quest_receive_pilgrims
            clr_character_flag = ggsm_receive_pilgrims_mission_started
            set_variable = { which = ggsm_receive_pilgrims_months value = 0 }
        }
        else = {
            hidden_tooltip = {
                long_character_event = { id = ggsm.9301 days = 30 }
            }
        }
    }
}


#######################################
# MISSION CHAIN: COPY SCRIPTURE
#######################################

long_character_event = {
    id = ggsm.9340
    desc = ggsm.9340.desc
    picture = GFX_evt_ggsm_scripture_study
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_copy_scripture
    }

    option = {
        name = ggsm.mission.begin
        hidden_tooltip = {
            long_character_event = { id = ggsm.9341 days = 30 }
        }
    }
}

long_character_event = {
    id = ggsm.9341
    hide_window = yes
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_copy_scripture
    }

    immediate = {
        random_list = {
            34 = { long_character_event = { id = ggsm.9342 } }
            33 = { long_character_event = { id = ggsm.9343 } }
            33 = { long_character_event = { id = ggsm.9344 } }
        }
    }
}

long_character_event = {
    id = ggsm.9342
    desc = ggsm.9342.desc
    picture = GFX_evt_ggsm_scripture_study
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_copy_scripture
    }

    option = {
        name = ggsm.mission.continue
        change_variable = { which = ggsm_copy_scripture_months value = 1 }

        if = {
            limit = { check_variable = { which = ggsm_copy_scripture_months value = 12 } }
            add_society_currency_medium_effect = yes
            piety = 50
            clr_quest = ggsm_quest_copy_scripture
            clr_character_flag = ggsm_copy_scripture_mission_started
            set_variable = { which = ggsm_copy_scripture_months value = 0 }
        }
        else = {
            hidden_tooltip = {
                long_character_event = { id = ggsm.9341 days = 30 }
            }
        }
    }
}

long_character_event = {
    id = ggsm.9343
    desc = ggsm.9343.desc
    picture = GFX_evt_ggsm_scripture_study
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_copy_scripture
    }

    option = {
        name = ggsm.mission.continue
        change_variable = { which = ggsm_copy_scripture_months value = 1 }

        if = {
            limit = { check_variable = { which = ggsm_copy_scripture_months value = 12 } }
            add_society_currency_medium_effect = yes
            piety = 50
            clr_quest = ggsm_quest_copy_scripture
            clr_character_flag = ggsm_copy_scripture_mission_started
            set_variable = { which = ggsm_copy_scripture_months value = 0 }
        }
        else = {
            hidden_tooltip = {
                long_character_event = { id = ggsm.9341 days = 30 }
            }
        }
    }
}

long_character_event = {
    id = ggsm.9344
    desc = ggsm.9344.desc
    picture = GFX_evt_ggsm_scripture_study
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_copy_scripture
    }

    option = {
        name = ggsm.mission.continue
        change_variable = { which = ggsm_copy_scripture_months value = 1 }

        if = {
            limit = { check_variable = { which = ggsm_copy_scripture_months value = 12 } }
            add_society_currency_medium_effect = yes
            piety = 50
            clr_quest = ggsm_quest_copy_scripture
            clr_character_flag = ggsm_copy_scripture_mission_started
            set_variable = { which = ggsm_copy_scripture_months value = 0 }
        }
        else = {
            hidden_tooltip = {
                long_character_event = { id = ggsm.9341 days = 30 }
            }
        }
    }
}


#######################################
# MISSION CHAIN: WIDOWS ORPHANS
#######################################

long_character_event = {
    id = ggsm.9380
    desc = ggsm.9380.desc
    picture = GFX_evt_ggsm_houses_mercy
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_widows_orphans
    }

    option = {
        name = ggsm.mission.begin
        hidden_tooltip = {
            long_character_event = { id = ggsm.9381 days = 30 }
        }
    }
}

long_character_event = {
    id = ggsm.9381
    hide_window = yes
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_widows_orphans
    }

    immediate = {
        random_list = {
            34 = { long_character_event = { id = ggsm.9382 } }
            33 = { long_character_event = { id = ggsm.9383 } }
            33 = { long_character_event = { id = ggsm.9384 } }
        }
    }
}

long_character_event = {
    id = ggsm.9382
    desc = ggsm.9382.desc
    picture = GFX_evt_ggsm_houses_mercy
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_widows_orphans
    }

    option = {
        name = ggsm.mission.continue
        change_variable = { which = ggsm_widows_orphans_months value = 1 }

        if = {
            limit = { check_variable = { which = ggsm_widows_orphans_months value = 6 } }
            add_society_currency_minor_effect = yes
            piety = 40
            clr_quest = ggsm_quest_widows_orphans
            clr_character_flag = ggsm_widows_orphans_mission_started
            set_variable = { which = ggsm_widows_orphans_months value = 0 }
        }
        else = {
            hidden_tooltip = {
                long_character_event = { id = ggsm.9381 days = 30 }
            }
        }
    }
}

long_character_event = {
    id = ggsm.9383
    desc = ggsm.9383.desc
    picture = GFX_evt_ggsm_houses_mercy
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_widows_orphans
    }

    option = {
        name = ggsm.mission.continue
        change_variable = { which = ggsm_widows_orphans_months value = 1 }

        if = {
            limit = { check_variable = { which = ggsm_widows_orphans_months value = 6 } }
            add_society_currency_minor_effect = yes
            piety = 40
            clr_quest = ggsm_quest_widows_orphans
            clr_character_flag = ggsm_widows_orphans_mission_started
            set_variable = { which = ggsm_widows_orphans_months value = 0 }
        }
        else = {
            hidden_tooltip = {
                long_character_event = { id = ggsm.9381 days = 30 }
            }
        }
    }
}

long_character_event = {
    id = ggsm.9384
    desc = ggsm.9384.desc
    picture = GFX_evt_ggsm_houses_mercy
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_widows_orphans
    }

    option = {
        name = ggsm.mission.continue
        change_variable = { which = ggsm_widows_orphans_months value = 1 }

        if = {
            limit = { check_variable = { which = ggsm_widows_orphans_months value = 6 } }
            add_society_currency_minor_effect = yes
            piety = 40
            clr_quest = ggsm_quest_widows_orphans
            clr_character_flag = ggsm_widows_orphans_mission_started
            set_variable = { which = ggsm_widows_orphans_months value = 0 }
        }
        else = {
            hidden_tooltip = {
                long_character_event = { id = ggsm.9381 days = 30 }
            }
        }
    }
}


#######################################
# MISSION CHAIN: STEWARD HOUSE
#######################################

long_character_event = {
    id = ggsm.9420
    desc = ggsm.9420.desc
    picture = GFX_evt_ggsm_houses_mercy
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_steward_house
    }

    option = {
        name = ggsm.mission.begin
        hidden_tooltip = {
            long_character_event = { id = ggsm.9421 days = 30 }
        }
    }
}

long_character_event = {
    id = ggsm.9421
    hide_window = yes
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_steward_house
    }

    immediate = {
        random_list = {
            34 = { long_character_event = { id = ggsm.9422 } }
            33 = { long_character_event = { id = ggsm.9423 } }
            33 = { long_character_event = { id = ggsm.9424 } }
        }
    }
}

long_character_event = {
    id = ggsm.9422
    desc = ggsm.9422.desc
    picture = GFX_evt_ggsm_houses_mercy
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_steward_house
    }

    option = {
        name = ggsm.mission.continue
        change_variable = { which = ggsm_steward_house_months value = 1 }

        if = {
            limit = { check_variable = { which = ggsm_steward_house_months value = 12 } }
            add_society_currency_medium_effect = yes
            prestige = 35
            piety = 25
            clr_quest = ggsm_quest_steward_house
            clr_character_flag = ggsm_steward_house_mission_started
            set_variable = { which = ggsm_steward_house_months value = 0 }
        }
        else = {
            hidden_tooltip = {
                long_character_event = { id = ggsm.9421 days = 30 }
            }
        }
    }
}

long_character_event = {
    id = ggsm.9423
    desc = ggsm.9423.desc
    picture = GFX_evt_ggsm_houses_mercy
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_steward_house
    }

    option = {
        name = ggsm.mission.continue
        change_variable = { which = ggsm_steward_house_months value = 1 }

        if = {
            limit = { check_variable = { which = ggsm_steward_house_months value = 12 } }
            add_society_currency_medium_effect = yes
            prestige = 35
            piety = 25
            clr_quest = ggsm_quest_steward_house
            clr_character_flag = ggsm_steward_house_mission_started
            set_variable = { which = ggsm_steward_house_months value = 0 }
        }
        else = {
            hidden_tooltip = {
                long_character_event = { id = ggsm.9421 days = 30 }
            }
        }
    }
}

long_character_event = {
    id = ggsm.9424
    desc = ggsm.9424.desc
    picture = GFX_evt_ggsm_houses_mercy
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = {
        has_quest = ggsm_quest_steward_house
    }

    option = {
        name = ggsm.mission.continue
        change_variable = { which = ggsm_steward_house_months value = 1 }

        if = {
            limit = { check_variable = { which = ggsm_steward_house_months value = 12 } }
            add_society_currency_medium_effect = yes
            prestige = 35
            piety = 25
            clr_quest = ggsm_quest_steward_house
            clr_character_flag = ggsm_steward_house_mission_started
            set_variable = { which = ggsm_steward_house_months value = 0 }
        }
        else = {
            hidden_tooltip = {
                long_character_event = { id = ggsm.9421 days = 30 }
            }
        }
    }
}


#######################################
# MISSION CHAIN: FEAST MAGDALENE
#######################################

long_character_event = {
    id = ggsm.9460
    desc = ggsm.9460.desc
    picture = GFX_evt_ggsm_public_altar
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = { has_quest = ggsm_quest_feast_magdalene }

    option = {
        name = ggsm.mission.continue
        long_character_event = { id = ggsm.9461 }
    }
}

long_character_event = {
    id = ggsm.9461
    desc = ggsm.9461.desc
    picture = GFX_evt_ggsm_public_altar
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = { has_quest = ggsm_quest_feast_magdalene }

    option = {
        name = ggsm.mission.continue
        long_character_event = { id = ggsm.9462 }
    }
}

long_character_event = {
    id = ggsm.9462
    desc = ggsm.9462.desc
    picture = GFX_evt_ggsm_public_altar
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = { has_quest = ggsm_quest_feast_magdalene }

    option = {
        name = ggsm.mission.complete
        add_society_currency_major_effect = yes
            prestige = 75
            piety = 50
        clr_quest = ggsm_quest_feast_magdalene
        clr_character_flag = ggsm_feast_magdalene_mission_started
    }
}



#######################################
# DIRECT INVITATION TO THE ORDER
#######################################

# ROOT = invited Catholic woman
# FROM = Magdalene sister who sent the invitation
long_character_event = {
    id = ggsm.80
    desc = ggsm.80.desc
    picture = GFX_evt_ggsm_sacred_prostitution
    border = GFX_event_long_frame_religion
    is_triggered_only = yes

    trigger = {
        ggsm_adult_catholic_woman_trigger = yes
        NOT = { is_in_society = yes }
        can_join_society = ggsm_order_sacred_magdalene
    }

    option = {
        name = ggsm.80.a

        join_society = ggsm_order_sacred_magdalene

        hidden_tooltip = {
            long_character_event = { id = ggsm.1 }
        }

        ai_chance = {
            factor = 50

            modifier = {
                factor = 1.50
                trait = lustful
            }
            modifier = {
                factor = 2.00
                trait = nymphomaniac
            }
            modifier = {
                factor = 1.50
                trait = exhibitionist
            }
            modifier = {
                factor = 1.25
                trait = charitable
            }
            modifier = {
                factor = 1.15
                trait = kind
            }
            modifier = {
                factor = 1.15
                trait = theologian
            }
            modifier = {
                factor = 1.15
                trait = erudite
            }
            modifier = {
                factor = 0.50
                trait = chaste
            }
            modifier = {
                factor = 0.25
                trait = celibate
            }
            modifier = {
                factor = 0.50
                trait = cynical
            }
        }
    }

    option = {
        name = ggsm.80.b

        set_character_flag = ggsm_order_invitation_cooldown

        hidden_tooltip = {
            long_character_event = {
                id = ggsm.81
                days = 365
            }
        }

        ai_chance = {
            factor = 50
        }
    }
}


# Refusal cooldown reset
long_character_event = {
    id = ggsm.81
    hide_window = yes
    is_triggered_only = yes

    immediate = {
        clr_character_flag = ggsm_order_invitation_cooldown
    }
}


#######################################
# TARGETED POWER COOLDOWN RESETS
#######################################

# Carnal Charity target cooldown reset
long_character_event = {
    id = ggsm.82
    hide_window = yes
    is_triggered_only = yes

    immediate = {
        clr_character_flag = ggsm_carnal_charity_cooldown
    }
}


# Lover's Pox ministry target cooldown reset
long_character_event = {
    id = ggsm.83
    hide_window = yes
    is_triggered_only = yes

    immediate = {
        clr_character_flag = ggsm_lovers_pox_ministry_cooldown
    }
}


# Teach Virtue target cooldown reset
long_character_event = {
    id = ggsm.84
    hide_window = yes
    is_triggered_only = yes

    immediate = {
        clr_character_flag = ggsm_teach_virtue_cooldown
    }
}


